<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:oui="clr-namespace:OpenLS.UI" 
    x:Class="OpenLS.UI.Themes.MenuResources"
    xmlns:ouit="clr-namespace:OpenLS.UI.Themes"
    >
 <ResourceDictionary.MergedDictionaries>
        <ouit:Metrics/>
    <ouit:ContentPresenterResources/>
    <ouit:MenuItemResources/>
  </ResourceDictionary.MergedDictionaries> 
  <!--round brushes--> 

  <Style TargetType="{x:Type Rectangle}" x:Key="DebugRect2">
    <Setter Property="Width" Value="5"/>
    <Setter Property="Height" Value="10"/>
    <Setter Property="Visibility" Value="Visible"/>
  </Style>

  <Style TargetType="{x:Type Border}" x:Key="roundBorder">
    <Setter Property="CornerRadius" Value="2"/>
  </Style>
  <Style TargetType="{x:Type Menu}" x:Key="{x:Static oui:Styles.RibbonMenuStyleKey}">
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="FontFamily" Value="Tahoma" />
    <Setter Property="FontSize" Value="8pt" />
    <Setter Property="Foreground" Value="#333333" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property ="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <WrapPanel Orientation="Vertical"/>
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>

    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Menu}">
          <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" >
            <ItemsPresenter KeyboardNavigation.TabNavigation="Cycle" Margin="{TemplateBinding Padding}" />
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="oui:RibbonElement.ControlState" Value="Medium">
        <Setter Property ="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <WrapPanel Orientation="Vertical"/>
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="oui:RibbonElement.ControlState" Value="Small">
        <Setter Property ="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <WrapPanel Orientation="Vertical"/>
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="Separator_MenuItemStyle" TargetType="{x:Type MenuItem}">
    <Grid Margin="2 0 2 0" Height="1">
      <Rectangle Height="1" Fill="Gray" />
    </Grid>
  </ControlTemplate>
  <Style x:Key="MenuItem_SeparatorStyle" TargetType="{x:Type Separator}">
    <Setter Property="Template" Value="{DynamicResource Separator_MenuItemStyle}" />
  </Style>






    <Style x:Key="menuItemDefault" TargetType="{x:Type MenuItem}">
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Top"/>
        <Setter Property="Padding" Value="2" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />

        <Setter Property="oui:RibbonElement.Icon">
            <Setter.Value>
                <MultiBinding Converter="{x:Static oui:OfficeConverters.CommandToIconConverter}">
                    <Binding Path="Command" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(oui:RibbonElement.IconProvider)" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </Setter.Value>
        </Setter>
        <Setter Property="Icon" Value="{Binding Path=(oui:RibbonElement.Icon), RelativeSource={RelativeSource Self}}"/>
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static oui:OfficeBrushes.TextForegroundKey}}" />
        <Style.Triggers>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Path=Role, RelativeSource={RelativeSource Self}}" Value ="TopLevelHeader"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource {x:Static oui:UIComponents.TopLevelHeaderMenuItemLargeTemplateKey}}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Role, RelativeSource={RelativeSource Self}}" Value ="TopLevelHeader"/>
                    <Condition Binding="{Binding Path=(oui:RibbonElement.ControlState), RelativeSource={RelativeSource Self}}" Value ="Medium"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource {x:Static oui:UIComponents.TopLevelHeaderMenuItemMediumTemplateKey}}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Role, RelativeSource={RelativeSource Self}}" Value ="TopLevelHeader"/>
                    <Condition Binding="{Binding (oui:RibbonElement.ControlState), RelativeSource={RelativeSource Self}}" Value ="Small"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource {x:Static oui:UIComponents.TopLevelHeaderMenuItemSmallTemplateKey}}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
            </MultiDataTrigger>
            <Trigger Property="Role" Value="TopLevelHeader">
                <!--<Setter Property="Template" Value="{StaticResource TopLevelHeaderTemplateKey}" />
        <Setter Property="Grid.IsSharedSizeScope" Value="true" /> -->
            </Trigger>

            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property ="Role" Value="TopLevelHeader"/>
                    <Condition Property="Command" Value="{x:Null}"/>
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource TopLevelHeaderTemplateKeyNoCommand}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <!-- to remove-->
                    <Condition Property ="Role" Value="TopLevelHeader"/>
                    <Condition Property="Tag" Value="Small"/>
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource {x:Static oui:UIComponents.TopLevelHeaderMenuItemSmallTemplateKey}}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property ="Role" Value="TopLevelHeader"/>
                    <Condition Property="oui:RibbonElement.ControlState" Value="Small"/>
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource {x:Static oui:UIComponents.TopLevelHeaderMenuItemSmallTemplateKey}}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property ="Role" Value="TopLevelHeader"/>
                    <Condition Property="Command" Value="{x:Null}"/>
                    <Condition Property="Tag" Value="Small"/>
                    <!-- to remove-->
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{x:Static ouit:MenuItemResources.TopLevelHeaderSmallTemplateKeyNoCommand}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property ="Role" Value="TopLevelHeader"/>
                    <Condition Property="Command" Value="{x:Null}"/>
                    <Condition Property="oui:RibbonElement.ControlState" Value="Small"/>
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{x:Static ouit:MenuItemResources.TopLevelHeaderSmallTemplateKeyNoCommand}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
            </MultiTrigger>
            <Trigger Property="Role" Value="TopLevelItem">
                <Setter Property="Template" Value="{x:Static ouit:MenuItemResources.TopLevelItemTemplate}" />
            </Trigger>
            <Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="Template" Value="{x:Static ouit:MenuItemResources.SubmenuHeaderTemplate}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Role" Value="SubmenuHeader"/>
                    <Condition Property="Command" Value="{x:Null}"/>
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{x:Static ouit:MenuItemResources.SubmenuHeaderNoCommandTemplate}" />

            </MultiTrigger>
            <Trigger Property="Role" Value="SubmenuItem">
                <Setter Property ="Template" Value ="{StaticResource SubmenuItemTemplateKey}"/>
                <Setter Property="DockPanel.Dock" Value="Top" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                <Setter Property="Opacity" Value="0.5"/>
            </Trigger>

        </Style.Triggers>
    </Style>
    <Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}" BasedOn="{StaticResource menuItemDefault}">
        <Setter Property ="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=Command, Converter={x:Static oui:OfficeConverters.CommandToTextConverter}}"/>

    </Style>
    <Style x:Key="{x:Type ContextMenu}" TargetType="{x:Type ContextMenu}">
        <Style.Resources>
            <Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}" BasedOn="{StaticResource menuItemDefault}" />
        </Style.Resources>
        <Setter Property="Background" Value="Silver" />
        <Setter Property="BorderBrush" Value="Silver" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="FontFamily" Value="Tahoma" />
        <Setter Property="FontSize" Value="8pt" />
        <Setter Property="Foreground" Value="#333333" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Grid.IsSharedSizeScope" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContextMenu}">
                    <Border Background="White" BorderBrush="Silver" BorderThickness="1">
                        <ScrollViewer VerticalScrollBarVisibility="Auto">
                        <ItemsPresenter Margin="2" KeyboardNavigation.DirectionalNavigation="Cycle" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>